import { Navigate } from 'react-router-dom'
import { lazy } from 'react'
const Login = lazy(() => import('@/views/Login'))
const Register = lazy(() => import('@/views/Register'))
const Home = lazy(() => import('@/views/Home'))
const UserList = lazy(() => import('@/views/sys/UserList'))
const RoleList = lazy(() => import('@/views/sys/RoleList'))
const MenuList = lazy(() => import('@/views/sys/MenuList'))
const DistList = lazy(() => import('@/views/sys/DistList'))
const ProductType = lazy(() => import('@/views/prod/ProductType'))
const ProductList = lazy(() => import('@/views/prod/ProductList'))
const Dashboard = lazy(() => import('@/views/Dashboard'))
const NotFound = lazy(() => import('@/views/NotFound'))
const ProductUpdate = lazy(() => import('@/views/prod/ProductUpdate'))
const ProductDetail = lazy(() => import('@/views/prod/ProductDetail'))
const routes = [
    {
        path: '/login',
        element: <Login />
    },
    {
        path: '/register',
        element: <Register />
    },
    {
        path: '/',
        element: <Home />,
        children: [
            {
                index: true,
                element: <Navigate to={"dashboard"}></Navigate>
            },
            {
                path: 'dashboard',
                element: <Dashboard />
            },
            {
                path: 'userList',
                element: <UserList />
            },
            {
                path: 'roleList',
                element: <RoleList />
            },
            {
                path: 'menuList',
                element: <MenuList />
            },
            {
                path: 'distList',
                element: <DistList />
            },
            {
                path: 'productType',
                element: <ProductType />
            },
            {
                path: 'productList',
                element: <ProductList />
            },
            {
                path: 'productUpdate',
                element: <ProductUpdate />
            },
            {
                path: 'productDetail/:id',
                element: <ProductDetail />
            }
        ]
    },
    {
        path: '*',
        element: <NotFound />
    }
]
export default routes